package com.yiyi.credit.manage.abutment.common.enums;

public enum CcxiReturnCodeEnum {

    CODE0000("0000","处理成功"),
    CODE1001("1001","账号不存在或被禁用"),
    CODE1002("1002","账户余额不足"),
    CODE1003("1003","账户没有此接口访问权限"),
    CODE1011("1011","请求的资源不存在"),
    CODE1012("1012","参数为空或格式错误"),
    CODE1013("1013","验签失败"),
    CODE2001("2001","没有查询到结果"),
    CODE2010("2010","身份验证成功"),
    CODE2011("2011","身份验证失败"),
    CODE2012("2012","库中无记录"),
    CODE2013("2013","输入信息不符合要求"),
    CODE2021("2021","身份认证失败（身份证与姓名不匹配，卡号与身份证不匹配等具体情况）"),
    CODE2024("2024","身份认证失败（数据格式错误，不支持该银行卡验证等具体情况）"),
    CODE2030("2030","验证成功"),
    CODE2031("2031","验证失败"),
    CODE2060("2060","匹配成功"),
    CODE2061("2061","不一致"),
    CODE2062("2062","号码不存在"),
    CODE2063("2063","手机号一致， 无身份证或姓名信息"),
    CODE9901("9901","系统繁忙，请稍后再试"),
    CODE9902("9902","系统维护中，请稍后再试"),
    CODE9999("9999","系统错误");

    private final String code;
    private final String value;

    CcxiReturnCodeEnum(String code, String value)
    {
        this.code = code;
        this.value = value;
    }

    public String getCode()
    {
        return code;
    }

    public String getValue()
    {
        return value;
    }

    public static boolean isCode(String code)
    {
        for (CcxiReturnCodeEnum s : CcxiReturnCodeEnum.values())
        {
            if (s.getCode().equals(code))
            {
                return true;
            }
        }
        return false;
    }
    /**
     * 根据编码获取信息
     * @param code
     * @return
     */
    public static String getValueByCode(String code)
    {
        for (CcxiReturnCodeEnum v : CcxiReturnCodeEnum.values())
        {
            if (v.getCode().equals(code))
            {
                return v.getValue();
            }
        }
        return null;
    }
}
